/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.drifter;

/**
 *
 * @author Aaron
 */

import java.util.Random;

public class MapGen {
    private long mapSeed;
    private Map map;

    // Lower numbers give a higher chance.
    private int grassChance = 15;

    public MapGen() {
        this.mapSeed = System.currentTimeMillis();
    }
    
    public Map generateMap() {
        this.map = new Map(128, 128, 4, 4);

        Random random = new Random(mapSeed);

        for (int i = 0; i < map.getWidth(); i++) {
            for (int j = 0; j < map.getHeight(); j++) {
                if (mapSeed % Math.max((Math.max((i + j) % grassChance, random.nextInt(grassChance))), 1) == 0) {
                    map.getMapCell(i, j).setTileType(Map.TileEnum.GRASS);
                }
            }
        }

        return map;
    }
    
}
